const dayjs = require('dayjs')
/**
 * 首先获取当前日期，然后根据当前日期判断开始时间和结束时间的取值
 * @returns {{start: *, end: string}}
 */
export const useSetStartAndEndDates = () => {
  const today = dayjs()
  let start
  let end
  if (today.isBefore(dayjs(today.format('YYYY-06-01')))) {
    start = dayjs(today.subtract(1, 'year').format('YYYY-06-01'))
    end = dayjs(today.subtract(1, 'year').format('YYYY-08-01')).endOf('month')
  } else {
    start = dayjs(today.format('YYYY-06-01'))
    end = dayjs(today.format('YYYY-08-01')).endOf('month')
  }
  return {
    start: start.format('YYYY-MM-DD'),
    end: end.format('YYYY-MM-DD')
  }
}
